import request from '@/utils/request'

// 查询设备监控列表
export function listDevices(query) {
  return request({
    url: '/device/monitor/devices',
    method: 'get',
    params: query
  })
}

// 查询设备下的用户列表
export function listUsers(deviceId) {
  return request({
    url: '/device/monitor/users/' + deviceId,
    method: 'get'
  })
}

// 获取用户详情
export function getUserDetail(id) {
  return request({
    url: '/device/monitor/user/' + id,
    method: 'get'
  })
}

// 踢出用户
export function kickoutUser(id) {
  return request({
    url: '/device/monitor/kickout/' + id,
    method: 'put'
  })
}

// 延长用户上网时间
export function extendUserTime(id, extendMinutes) {
  return request({
    url: '/device/monitor/extend',
    method: 'put',
    data: {
      id: id,
      remark: extendMinutes.toString()
    }
  })
}

// 拉黑用户
export function blacklistUser(id, reason) {
  return request({
    url: '/device/monitor/blacklist',
    method: 'put',
    data: {
      id: id,
      remark: reason
    }
  })
}

// 导出设备监控数据
export function exportDevices(query) {
  return request({
    url: '/device/monitor/export',
    method: 'post',
    params: query
  })
}

// 导出用户列表
export function exportUsers(query) {
  return request({
    url: '/device/monitor/export/users',
    method: 'post',
    params: query
  })
}

